package com.bigflexlib.ds.container.bag.impl
{
	
	
	import com.bigflexlib.ds.container.bag.IOWBag;
	import com.bigflexlib.ds.container.bag.IRWBag;
	import com.bigflexlib.ds.container.impl.AbstractOWContainerWrapper;
	import com.bigflexlib.ds.container.utils.ContainerUtil;

	
	public class OWBagWrapper extends AbstractOWContainerWrapper implements IOWBag
	{
	
	
		private var internalBag:IRWBag;	
	
	
		public function OWBagWrapper( internalBag:IRWBag )
		{
			
			super( internalBag );
		
			this.internalBag = internalBag;
		
		}
	
		

		
		public function add( e:*, multiplicityDelta:int ):void
		{

			
			if ( someoneIsWatching )
			{
				beforeChange( e );
				internalBag.add( e, multiplicityDelta );	
				afterChange( e );					
			}
			else
			{
				internalBag.add( e, multiplicityDelta );	
			}
			
			
		}
		
		
		
		
		public function setMultiplicity( e:*, absoluteMultiplicity:uint ):void
		{
		
			
			if ( someoneIsWatching )
			{
				beforeChange( e );
				internalBag.setMultiplicity( e , absoluteMultiplicity );
				afterChange( e, absoluteMultiplicity );
			}
			else
			{
				internalBag.setMultiplicity( e, absoluteMultiplicity );
			}
			
			
		
		
		
		}	
		
		
		
		
		

		
		
		
		
	}

}